<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Recommended Project Directory Structure - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/project-structure.project.html">Inglês (English)</a></li>
    <li><a href="../pt-br/project-structure.project.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="project-structure.overview.html">Overview</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="project-structure.html">Recommended Project Structure for Zend Framework MVC Applications</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="project-structure.filesystem.html">Module Structure</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="project-structure.project" class="section"><div class="info"><h1 class="title">Recommended Project Directory Structure</h1></div>
        

        <pre class="programlisting brush: text">
&lt;project name&gt;/
    application/
        configs/
            application.ini
        controllers/
            helpers/
        forms/
        layouts/
            filters/
            helpers/
            scripts/
        models/
        modules/
        services/
        views/
            filters/
            helpers/
            scripts/
        Bootstrap.php
    data/
        cache/
        indexes/
        locales/
        logs/
        sessions/
        uploads/
    docs/
    library/
    public/
        css/
        images/
        js/
        .htaccess
        index.php
    scripts/
        jobs/
        build/
    temp/
    tests/
</pre>


        <p class="para">
            The following describes the use cases for each directory as listed.
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">application/</var></em>: This directory contains
                    your application. It will house the <acronym class="acronym">MVC</acronym> system, as well as
                    configurations, services used, and your bootstrap file.
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">configs/</var></em>: The
                            application-wide configuration directory.
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">controllers/</var></em>,
                            <em class="emphasis"><var class="filename">models/</var></em>, and
                            <em class="emphasis"><var class="filename">views/</var></em>: These directories
                            serve as the default controller, model or view directories. Having
                            these three directories inside the application directory provides the
                            best layout for starting a simple project as well as starting a modular
                            project that has global <var class="filename">controllers/models/views</var>.
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">controllers/helpers/</var></em>: These
                            directories will contain action helpers. Action helpers will be
                            namespaced either as &quot;<span class="classname">Controller_Helper_</span>&quot; for
                            the default module or &quot;&lt;Module&gt;_Controller_Helper&quot; in other
                            modules.
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">layouts/</var></em>: This layout
                            directory is for <acronym class="acronym">MVC</acronym>-based layouts. Since
                            <span class="classname">Zend_Layout</span> is capable of
                            <acronym class="acronym">MVC</acronym>- and non-<acronym class="acronym">MVC</acronym>-based layouts,
                            the location of this directory reflects that layouts are not on a
                            1-to-1 relationship with controllers and are independent of templates
                            within <var class="filename">views/</var>.
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">modules/</var></em>: Modules allow a
                            developer to group a set of related controllers into a logically
                            organized group. The structure under the modules directory would
                            resemble the structure under the application directory.
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">services/</var></em>: This directory is
                            for your application specific web-service files that are provided by
                            your application, or for implementing a <a href="http://www.martinfowler.com/eaaCatalog/serviceLayer.html" class="link external">&raquo; Service
                                Layer</a> for your models.
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <em class="emphasis"><var class="filename">Bootstrap.php</var></em>: This file is
                            the entry point for your application, and should implement
                            <span class="classname">Zend_Application_Bootstrap_Bootstrapper</span>.
                            The purpose for this file is to bootstrap the application and make
                            components available to the application by initializing them.
                        </p>
                    </li>
                </ul>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">data/</var></em>: This directory provides a
                    place to store application data that is volatile and possibly temporary. The
                    disturbance of data in this directory might cause the application to fail.
                    Also, the information in this directory may or may not be committed to a
                    subversion repository. Examples of things in this directory are session files,
                    cache files, sqlite databases, logs and indexes.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">docs/</var></em>: This directory contains
                    documentation, either generated or directly authored.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">library/</var></em>: This directory is for
                    common libraries on which the application depends, and should be on the
                    <acronym class="acronym">PHP</acronym> <span class="property">include_path</span>. Developers should
                    place their application&#039;s library code under this directory in a unique
                    namespace, following the guidelines established in the <acronym class="acronym">PHP</acronym>
                    manual&#039;s <a href="http://www.php.net/manual/en/userlandnaming.php" class="link external">&raquo; Userland Naming
                        Guide</a>, as well as those established by Zend itself. This
                    directory may also include Zend Framework itself; if so, you would house it in
                    <var class="filename">library/Zend/</var>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">public/</var></em>: This directory contains all
                    public files for your application. <var class="filename">index.php</var> sets up and
                    invokes <span class="classname">Zend_Application</span>, which in turn invokes the
                    <var class="filename">application/Bootstrap.php</var> file, resulting in dispatching
                    the front controller. The web root of your web server would typically be set to
                    this directory.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">scripts/</var></em>: This directory contains
                    maintenance and/or build scripts. Such scripts might include command line,
                    cron, or phing build scripts that are not executed at runtime but are part of
                    the correct functioning of the application.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">temp/</var></em>: The <var class="filename">temp/</var>
                    folder is set aside for transient application data. This information would not
                    typically be committed to the applications svn repository. If data under the
                    <var class="filename">temp/</var> directory were deleted, the application should be
                    able to continue running with a possible decrease in performance until data is
                    once again restored or recached.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><var class="filename">tests/</var></em>: This directory contains
                    application tests. These could be hand-written, PHPUnit tests, Selenium-RC
                    based tests or based on some other testing framework. By default, library code
                    can be tested by mimicing the directory structure of your
                    <var class="filename">library/</var> directory. Additionally, functional tests for
                    your application could be written mimicing the
                    <var class="filename">application/</var> directory structure (including the
                    application subdirectory).
                </p>
            </li>
        </ul>
    </div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="project-structure.overview.html">Overview</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="project-structure.html">Recommended Project Structure for Zend Framework MVC Applications</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="project-structure.filesystem.html">Module Structure</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="project-structure.html">Recommended Project Structure for Zend Framework MVC Applications</a></li>
  <li><a href="project-structure.overview.html">Overview</a></li>
  <li class="active"><a href="project-structure.project.html">Recommended Project Directory Structure</a></li>
  <li><a href="project-structure.filesystem.html">Module Structure</a></li>
  <li><a href="project-structure.rewrite.html">Rewrite Configuration Guide</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>